﻿using System;
using System.Data;

namespace LinqRepositorySample.Data.LinqToSql
{
    public static class IsolationConverter
    {
        public static System.Transactions.IsolationLevel ToTransactionsIsolation(System.Data.IsolationLevel level)
        {
            switch (level)
            {
                case (IsolationLevel.Chaos):
                    return System.Transactions.IsolationLevel.Chaos;
                case (IsolationLevel.ReadCommitted):
                    return System.Transactions.IsolationLevel.ReadCommitted;
                case (IsolationLevel.ReadUncommitted):
                    return System.Transactions.IsolationLevel.ReadUncommitted;
                case (IsolationLevel.RepeatableRead):
                    return System.Transactions.IsolationLevel.RepeatableRead;
                case (IsolationLevel.Serializable):
                    return System.Transactions.IsolationLevel.Serializable;
                case (IsolationLevel.Snapshot):
                    return System.Transactions.IsolationLevel.Snapshot;
                case (IsolationLevel.Unspecified):
                    return System.Transactions.IsolationLevel.Unspecified;
                default:
                    return System.Transactions.IsolationLevel.Serializable;
            }
        }
    }
}
